package main

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
	"gorm.io/gorm/schema"
)

/*
	type User struct {
		//gorm.Model
		Username string
		Pass     int
	}
*/
func main() {
	//db, err := gorm.Open("mysql", "root:170815@(10.1.3.10:3306)/user?charset=utf8mb4&parseTime=True&loc=local)
	//db, err := gorm.Open(mysql.Open("lianxi"), &gorm.Config{})
	dsn := "root:170815@tcp(10.1.3.10:3306)/lianxi?charset=utf8mb4&parseTime=True&loc=Local"
	db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{
		NamingStrategy: schema.NamingStrategy{
			SingularTable: true,
			NoLowerCase:   true,
		},
	})
	if err != nil {
		panic(err)
	}

	u1 := User{"小婉", 12345}
	db.Create(&u1)

	//db.Create(&User{username: 12, pass: 12345})

}
